#include<iostream>
#include<pthread.h>
#include<unistd.h>

void* newthreadrun(void*args)
{
    while(true)
    {
        std::cout<<"I am a new thread"<<std::endl;
        sleep(1);
    }
}

int main()
{
    pthread_t id;
    int ret=pthread_create(&id,nullptr,newthreadrun,nullptr);
    if(ret!=0)
    {
        perror("pthread_create");
        exit(-1);
    }
    while(true)
    {
        std::cout<<"I am the main thread"<<std::endl;
        sleep(1);
    }
    return 0;
}